#include <stdio.h>

int main() {
	int ori,tar=0,offset,pow=1,arr[]={0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9};
	scanf("%d%d",&ori,&offset);if(offset<0||offset>9) return 0;
	do
		tar+=arr[ori%10+offset]*pow;
	while(pow*=10, ori/=10);
	printf("%d\n",tar);
	return 0;
}